﻿using System;
using System.ComponentModel;

namespace Epon.EponEl5600
{
    /// <summary>
    ///     通知抽象类实现
    /// </summary>
    /// <remarks>
    ///     
    /// </remarks>
    public abstract class NotifyPropertyChanged : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        ///     单个参数通知
        /// </summary>
        /// <param name="propertyName" type="string">
        ///     <para>
        ///         
        ///     </para>
        /// </param>
        protected void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        /// <summary>
        ///     多个参数通知
        /// </summary>
        /// <param name="propertyNames" type="string[]">
        ///     <para>
        ///         
        ///     </para>
        /// </param>
        protected void OnPropertyChanged(params  string[] propertyNames)
        {
            if (PropertyChanged == null)
                return;
            if (propertyNames == null) throw new ArgumentNullException("propertyNames");
            foreach (var propertyName in propertyNames)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
